<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        .a {
            width: 300px;
            height: 300px;
            background-color: #ddd;
            position: relative;
        }

        .a1 {
            width: 300px;
            height: 150px;
            background-color: #f00;

            position: absolute;
            top: 0;
            left: 0;

            height: 0;
            overflow: hidden;
            transition: .3s;
        }

        .a2 {
            width: 300px;
            height: 150px;
            background-color: #f00;

            position: absolute;
            bottom: 0;
            left: 0;

            height: 0;
            overflow: hidden;
            transition: .3s;
        }

        .a:hover .a1 {
            height: 150px;
        }

        .a:hover .a2 {
            height: 150px;
        }


        .b {
            width: 300px;
            height: 300px;
            background-color: #ddd;
            position: relative;
        }

        .b1 {
            width: 150px;
            height: 300px;
            background-color: #f00;

            position: absolute;
            top: 0;
            left: 0;

            width: 0;
            overflow: hidden;
            transition: .3s;
        }

        .b2 {
            width: 1500px;
            height: 300px;
            background-color: #f00;

            position: absolute;
            bottom: 0;
            right: 0;

            width: 0;
            overflow: hidden;
            transition: .3s;
        }

        .b:hover .b1 {
            width: 150px;
        }

        .b:hover .b2 {
            width: 150px;
        }
    </style>
</head>

<body>
    <div class="a">
        <!-- 内容 -->
        <div class="a1"></div>
        <div class="a2"></div>
    </div>

    <div class="b">
        <div class="b1"></div>
        <div class="b2"></div>
    </div>
</body>

</html>